package main

import (
	"regexp"
	"fmt"
)

const text string = `My Email is gexiang0523@163.com
email1 is 597863201@qq.com
email2 is gexiang@qq.com
email3 is gexiang@baidu.com
`

func main() {
	//compile, e := regexp.Compile(`.+@.+\..+`)
	re := regexp.MustCompile(`([a-zA-Z0-9]+)@(.+\..+)`)
	
	//s := re.FindString(text)   gexiang0523@163.com
	//s := re.FindAllString(text, -1)     //[gexiang0523@163.com 597863201@qq.com gexiang@qq.com gexiang@baidu.com]
	
	s := re.FindAllStringSubmatch(text, -1)
	fmt.Println(s)
}
